package com.winlose;

import com.image.Computer;
import com.image.Person;
import lombok.extern.slf4j.Slf4j;

import java.util.Random;
import java.util.Scanner;

@Slf4j
public class WinLoseImpl implements WinLose {

    @Override
    public int rule(int person, int computer) {

        int result = 4;

        if (person - computer == 0){
            log.info("平局了");
            result = 1;
        }else if ((person - computer + 3) % 3 == 2){
            log.info("你赢了");
            result = 2;
        }else if ((person - computer + 3) % 3 == 1){
            log.info("你输了");
            result = 3;
        }
        return result;
    }
}
/**
 switch (ran) {
 case 1:
 System.out.println("电脑出" + a);
 log.info("电脑出" + a);
 if (a.equals(person1.getHand())) {
 System.out.println("平局了");
 log.info("平局了");
 p++;
 } else if (c.equals(person1.getHand())) {
 System.out.println("你赢了");
 log.info("你赢了");
 y++;
 } else if (b.equals(person1.getHand())) {
 System.out.println("你输了");
 log.info("你输了");
 s++;
 }
 break;
 case 2:
 System.out.println("电脑出" + b);
 log.info("电脑出" + b);
 if (b.equals(person1.getHand())) {
 System.out.println("平局了");
 log.info("平局了");
 p++;
 } else if (a.equals(person1.getHand())) {
 System.out.println("你赢了");
 log.info("你赢了");
 y++;
 } else if (c.equals(person1.getHand())) {
 System.out.println("你输了");
 log.info("你输了");
 s++;
 }
 break;
 case 3:
 System.out.println("电脑出" + c);
 log.info("电脑出" + c);
 if (c.equals(person1.getHand())) {
 System.out.println("平局了");
 log.info("平局了");
 p++;
 } else if (b.equals(person1.getHand())) {
 System.out.println("你赢了");
 log.info("你赢了");
 y++;
 } else if (a.equals(person1.getHand())) {
 System.out.println("你输了");
 log.info("你输了");
 s++;
 }
 break;
 default:
 System.out.println("输入错误");
 log.info("输入错误");
 break;
 }
 **/
/**System.out.println("平局：" + p + " 胜场：" + y + " 败场：" + s);**/